<!DOCTYPE html>
<html>
  <!--
  Copyright (c) 2012 The Chromium Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.
  -->
<head>
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="Expires" content="-1">
  <script type="text/javascript">
    function pageDidLoad() {
      appendStatus('Page loaded');
    }

    function appendStatus(opt_message) {
      var statusField = document.getElementById('statusField');
      if (statusField) {
        var newElt = document.createElement("opt_message");
        newElt.innerHTML = "<br>" + opt_message;
        statusField.appendChild(newElt);
      }
    }

    function handleMessage(message_event) {
     appendStatus(message_event.data);
    }
 </script>
</head>
<body onload="pageDidLoad()">
  <div id="listener">
    <script type="text/javascript">
        var listener = document.getElementById('listener');
        listener.addEventListener('message', handleMessage, true);
    </script>
    <h2>NaCl Module</h2>
    <embed name="nacl_module"
      id="nacl_module"
      style="border-style: solid;"
      width=200
      height=200
      src="newlib/hello_nacl.nmf"
      type="application/x-nacl"/>
  </div>
  <div>
  <h2>Messages: <code id="statusField"></code></h2>
  </div>
</body>
</html>
